import { Button, Spin } from "antd"
import React, { useState, type PropsWithChildren } from "react"

export default function useLoading() {
  const [loading, setLoading] = useState<boolean>(true)
  const Loading = ({ children }: PropsWithChildren) => {
    return (
      <>
        {loading ? (
          <div className="flex justify-centr items-center">
            <Spin></Spin>
          </div>
        ) : (
          <>{children}</>
        )}
      </>
    )
  }
  return {
    Loading,
    setLoading
  }
}
